1. Field of the Invention
The present invention relates generally to the field of memory allocation and, in particular, to the simulation of memory allocation failures based on memory sizes.
2. Description of Related Art
The need for reliable computing systems has lead to the development of “highly available” computer systems that continue to function when one or more of the subsystems or components of a computing system fail.
In order to ensure that highly available computer systems operate properly, it is necessary to perform rigorous testing. This testing is complicated by the fact that highly available computer systems typically include a large number of components and subsystems that are subject to failure. Furthermore, an operating system for a highly available computer system contains a large number of pathways to handle error conditions that must also be tested.
Some types of testing can be performed manually, for example by unplugging a computer system component, disconnecting a cable, or by pulling out a computer system board while the computer system is running. However, an outcome of this type of manual testing is typically not repeatable and is imprecise because the manual event can happen at random points in the execution path of a program or operating system that is executing on the highly available computer system.
For example, memory allocation error simulations for software applications can be difficult to reproduce. The inability to easily reproduce these errors leads to difficulties in error checking and debugging of the applications.
Current solutions that simulate memory allocation errors in software are based on memory allocation failures at certain frequencies based on time, an incremental count, or a randomly generated number. The frequency based solutions introduce too much randomness for reproducing the failure for diagnostic purposes. The frequency based error injection solutions make it difficult to reproduce errors in a multithreaded environment.
For example, in the C programming language, applications use the function malloc( ) to allocate a piece of storage, the function free( ) to release the storage for subsequent reuse, and the function realloc( ) to change the size of a piece of storage. (The double parentheses are standard notation for C library calls.) These functions, which are sometimes referred to as heap management, are well known in the art and are described in any of a number of references on the C programming language and its extensions. However, the standard available solutions do not allow easy reproduction of memory allocation errors.
Thus, there is a need for an improved method and an apparatus that facilitates testing a computer system by injecting faults at precise locations based on the requested sizes for memory allocation in the execution path of an application that is executed on the computer system.